<?php

namespace app\modules\sysConfig\models;

use Yii;

/**
 * This is the model class for table "rah_sms".
 *
 * @property integer $smsID
 * @property string $smsType
 * @property string $phones
 * @property string $body
 * @property string $createTime
 * @property string $createUser
 * @property string $responseCode
 * @property string $smsCode
 */
class Sms extends \yii\db\ActiveRecord {
    /**
     * @inheritdoc
     */
 public $lender_count; //手机条数
 
    public static function tableName() {
        return 'rah_sms';
    }

    /**
     * @inheritdoc
     */
    public function rules() {
        return [
            [['createTime','responseCode','smsCode','createUser','responseCode','body'], 'safe'],
            [['createTime','smsType','phones'], 'required'],
            [['smsType', 'createUser'], 'string', 'max' => 50],
            [['body'], 'string', 'max' => 500],
            [['responseCode'], 'string', 'max' => 20],
            [['smsCode'], 'string', 'max' => 100],
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels() {
        return [
            'smsID' => 'Sms ID',
            'smsType' => '短信类型',
            'phones' => '手机号码地址',
            'body' => '短信内容',
            'createTime' => '发送短信时间',
            'createUser' => 'Create User',
            'responseCode' => 'Response Code',
            'smsCode' => 'Sms Code',
            'lender_userName' => '理财客户',
            'lender_companyName' => '投资部门',
            'lender_phone' => '联系电话',
            'lender_identityNo' => '身份证号码',
            'lender_userName' => '理财客户',
            'lender_accountStatus' => '账户状态',
            'lender_customerManagerName' => '客户经理',
            'lender_strcreateTime' => '开始创建时间',
            'lender_endcreateTime' => '结束创建时间',
            'lender_IDType' => '证件类型',
            'borrower_userName' => '借款客户',
        ];
    }

    /**
     * 获取短信模板
     * @param type $type
     * @return boolean
     */
    public function getTemplates($type){
        $model = Smstemplate::find()->where(['type'=>$type])->one();
        if(isset($model)){
            return $model;
        }else{
            return false;
        }
    }
}
